import { createRouter,createWebHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    // 配置admin路由，有两个字路由图片库，图片列表

    {
      // admin 父路由
      path:"/admin",
      name:'admin',
      component:()=>import('../views/admin/AdminView.vue'),
      // 图片类别
      children:[
        {
          path: 'assets/gallery/picList/:id',
          name: 'piclist',
          component: ()=>import('../views/admin/assets/PicList.vue')
        },
        // 图片库
        {
          path: 'assets/gallery/albumList',
          name: 'albumList',
          component: ()=>import('../views/admin/assets/AlbumList.vue')
        },
        // 如果为空，重定向图片库
        {
          path:'',
          redirect:"/admin/assets/gallery/albumList"
        }
      ]
    },
   
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    }
  ]
})

export default router
